package com.pubinfo.passbook.common.enums;

import com.pubinfo.passbook.common.exception.ServiceException;
import com.pubinfo.passbook.common.model.vo.base.BusinessErrorCode;
import lombok.Getter;

/**
 * 合同发票申请状态
 */
@Getter
public enum ContractInvoiceStatusEnum {
  ERROR(-1, "调用失败"),
  APPLY(0, "已提交申请"),
  DONE(10, "已开发票"),
  ;
  
  private Integer status;
  
  private String desc;
  
  ContractInvoiceStatusEnum(Integer status, String desc) {
    this.status = status;
        this.desc = desc;
    }

    public static ContractInvoiceStatusEnum getEnum(Integer status) {
        for (ContractInvoiceStatusEnum e : ContractInvoiceStatusEnum.values()) {
            if (status == e.getStatus()) {
                return e;
            }
        }
        throw new ServiceException(BusinessErrorCode.STATUS_NOT_EXIST);
    }

}
